package com.bxd.baodan.widget;

import android.app.Dialog;
import android.content.Context;
import android.view.Gravity;
import android.widget.TextView;

import com.bxd.baodan.R;

public class CustomProgressDialog extends Dialog {
	public CustomProgressDialog(Context context, String strMessage) {
		this(context, R.style.CustomProgressDialog, strMessage);
	}

	public CustomProgressDialog(Context context, int theme, String strMessage) {
		super(context, theme);
		//this.setContentView(R.layout.plugin_progress_dialog);
		this.setContentView(R.layout.custom_dialog);
		this.getWindow().getAttributes().gravity = Gravity.CENTER;
		TextView tvMsg = (TextView) this.findViewById(R.id.TextView01);
		if (tvMsg != null) {
			tvMsg.setText(strMessage);
		}
	}



	/**
	 * 当窗口焦点改变时调用
	 */
	public void onWindowFocusChanged(boolean hasFocus) {
//		ImageView imageView = (ImageView) findViewById(R.params.progressBar2);
//		// 获取ImageView上的动画背景
//		AnimationDrawable spinner = (AnimationDrawable) imageView.getBackground();
//		// 开始动画
//		spinner.start();
		if (!hasFocus) {
			dismiss();
		}
	}
}